package org.classes;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.util.logging.Level;
import java.util.logging.Logger;

public class String2Sha {
 
    public String getEncodedSha1Sum( String key ) {
        String retorno = null;
        try {
            MessageDigest md = MessageDigest.getInstance( "SHA1" );
            md.update( key.getBytes("UTF-8") );
            retorno = new BigInteger( 1, md.digest() ).toString(16);
        }
        catch (Exception ex) {
            Logger.getLogger(String2Sha.class.getName()).log(Level.SEVERE, null, ex);
        }               
        return retorno;
    }
    
}
